package com.xoa.controller.performance;

import com.xoa.model.performance.ScoreFlowUsers;
import com.xoa.service.performance.ScoreFlowUserService;
import com.xoa.util.common.wrapper.BaseWrapper;
import com.xoa.util.page.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("scoreFlowUser")
public class ScoreFlowUserController {

    @Autowired
    private ScoreFlowUserService scoreFlowUserService;

    @RequestMapping("userList")
    public String userListPage() {
        return "app/hr/scoreFlowUser/userList";
    }

    @RequestMapping("setting")
    public String setting() {
        return "app/hr/scoreFlowUser/setting";
    }

    @RequestMapping("settingDetail")
    public String settingDetail() {
        return "app/hr/scoreFlowUser/settingDetail";
    }

    @RequestMapping("scoreDetail")
    public String scoreDetail() {
        return "app/hr/scoreFlowUser/scoreDetail";
    }

    @RequestMapping("selectUser")
    public String selectUsers() {
        return "app/hr/scoreFlowUser/selectUser";
    }

    @RequestMapping("selectDept")
    public String selectDept() {
        return "app/hr/scoreFlowUser/selectDept";
    }

    /**
     * @接口说明: 获取某个考核任务下的所有被考核人
     * @日期: 2020/7/18
     * @作者: 张航宁
     */
    @ResponseBody
    @RequestMapping("selFlowUsers")
    public BaseWrapper selFlowUsers(HttpServletRequest request, HttpServletResponse response,PageParams pageParams, String userId,Integer flowId,Boolean export) {
        return scoreFlowUserService.selFlowUsers(request,response,pageParams,userId,flowId,export);
    }

    /**
     * @接口说明: 删除接口
     * @日期: 2020/7/20
     * @作者: 张航宁
     */
    @ResponseBody
    @RequestMapping("delete")
    public BaseWrapper delete(String ids){
        return scoreFlowUserService.delete(ids);
    }

    /**
     * @接口说明: 获取某个考核任务下的 被考核人员的所有考核人
     * @日期: 2020/7/20
     * @作者: 张航宁
     */
    @ResponseBody
    @RequestMapping("selAssessors")
    public BaseWrapper selAssessors(String userId,Integer scoreFlowId){
        return scoreFlowUserService.selAssessors(userId, scoreFlowId);
    }

    /**
     * @接口说明: 设置考核人员
     * @日期: 2020/7/20
     * @作者: 张航宁
     */
    @ResponseBody
    @RequestMapping("setAssessors")
    public BaseWrapper setAssessors(HttpServletRequest request, ScoreFlowUsers scoreFlowUsers, String insertType, String userIds) {
        return scoreFlowUserService.setAssessors(request ,scoreFlowUsers, insertType, userIds);
    }

    /**
     * @接口说明: 查询该任务下的所有需要评测的人员
     * @日期: 2020/7/20
     * @作者: 张航宁
     */
    @ResponseBody
    @RequestMapping("selByAssessor")
    public BaseWrapper selByAssessor(HttpServletRequest request,Integer scoreFlowId){
        return scoreFlowUserService.selByAssessor(request, scoreFlowId);
    }

    /**
     * @接口说明: 评价考核明细查询接口
     * @日期: 2020/7/22
     * @作者: 张航宁
     */
    @ResponseBody
    @RequestMapping("selUserScoreDetail")
    public BaseWrapper selUserScoreDetail(Integer flowId,String userId){
        return scoreFlowUserService.selUserScoreDetail(flowId, userId);
    }


    /**
     * @接口说明: 查询被考核人的总分
     * @日期: 2020/7/23
     * @作者: 张航宁
     */
    @ResponseBody
    @RequestMapping("selUserScoreCount")
    public BaseWrapper selUserScoreCount(Integer flowId,String userId){
        return scoreFlowUserService.selUserScoreCount(flowId, userId);
    }
    /**
     * create by:李善澳
     * description: 获取整体考核考核任务下所有人员关系表
     * create time: 2020-09-20 13:00
     * @return
     */
    @ResponseBody
    @RequestMapping("getAllData")
    public BaseWrapper getAllData(Integer flowId){
        return scoreFlowUserService.getAllData(flowId);
    }
}
